package com.ruge.common.util;

/**
 * @author ：爱丽丝、如歌
 * @time ：2020/3/21  13:41
 * 描述 ：
 */
public class DateUtil {

    public static String millisToStringHMS(long millis) {
        StringBuilder strBuilder = new StringBuilder();
        long temp = millis;
        long hper = 60 * 60 * 1000;
        long mper = 60 * 1000;
        long sper = 1000;
        if (temp / hper > 0) {
            strBuilder.append(temp / hper).append("小时");
        }
        temp = temp % hper;

        if (temp / mper > 0) {
            strBuilder.append(temp / mper).append("分钟");
        }
        temp = temp % mper;
        if (temp / sper > 0) {
            strBuilder.append(temp / sper).append("秒");
        }
        return strBuilder.toString();
    }
    public static String millisToStringMS(long millis) {
        StringBuilder strBuilder = new StringBuilder();
        long temp = millis;
        long mper = 60 * 1000;
        long sper = 1000;

        if (temp / mper > 0) {
            strBuilder.append(temp / mper).append("分钟");
        }
        temp = temp % mper;
        if (temp / sper > 0) {
            strBuilder.append(temp / sper).append("秒");
        }
        return strBuilder.toString();
    }

    public static String millisToStringS(Long millis) {
        StringBuilder strBuilder = new StringBuilder();
        Double temp = millis.doubleValue();
        long sper = 1000;
        if (temp / sper > 0) {
            strBuilder.append(temp / sper).append("秒");
        }
        return strBuilder.toString();
    }
}
